doctype html
html(lang="en")
  head
    meta(http-equiv="Content-Type", content="text/html; charset=UTF-8")
    meta(charset="utf-8")
    title= page.title + ' - ' + config.site
    meta(name="viewport", content="width=device-width, initial-scale=1.0")

    if config.noCDN

      link(href="/stylesheet/bootstrap-combined.no-icons.min.css", rel="stylesheet")
      link(href="/stylesheet/font-awesome.min.css", rel="stylesheet")
      link(href="/stylesheet/fineuploader.css", rel="stylesheet")
      link(href="/stylesheet/select2.css", rel="stylesheet")

    else

      link(href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css", rel="stylesheet", integrity="sha384-nITPVmSN/64KqhfcWtEJQwuzHIHqSgbSPmp74MISiB8zab+d6ThLyqTpw8bYMBqY", crossorigin="anonymous")
      link(href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css", rel="stylesheet", integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN", crossorigin="anonymous")
      link(href="//cdnjs.cloudflare.com/ajax/libs/file-uploader/3.1.1/fineuploader.css", rel="stylesheet", integrity="sha384-C1uGbpJ1NVxkJw+K28nyR5P7oWY/VD8Lx0DAsjBFkbMg5dyTRHOL9GExCfvV7b7q", crossorigin="anonymous")
      link(href="//cdnjs.cloudflare.com/ajax/libs/select2/3.4.1/select2.min.css", rel="stylesheet", integrity="sha384-t087KIbF6xNxaqAXujy7+OhZdVNxg+hOPvSnopWEydtBFKWmlbnxx5GT/BFlu1hv", crossorigin="anonymous")

    link(href="/stylesheet/bootstrap-wysihtml5.css", rel="stylesheet")
    link(href="/stylesheet/bootstrap-lightbox.min.css", rel="stylesheet")

    // Finally, our own override sheet

    link(href="/stylesheet/pumpio.css", rel="stylesheet")

    if !config.noweb
      <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

  body

    .navbar.navbar-inverse.navbar-fixed-top
      .navbar-inner
        if page.nologin
          include ./nav-nologin
        else if principalUser
          include ../nav-loggedin
        else if principal
          include ../nav-remote
        else
          include ../nav-anonymous

    .container

      #content
        block body

      hr

      footer
        if config.owner
          p
            b #{config.site} 
            | brought to you by 
            if config.ownerURL
              a(href=config.ownerURL) #{config.owner}
            else
              | #{config.owner}
            |. 
            if config.appendFooter
              | !{config.appendFooter}
        p
          a(href="http://pump.io/") pump.io
          |  available under the Apache License 2.0.
        if !config.noweb
          p
            a(href="/javascript/about.html", data-jslicense="1", data-bypass) JavaScript license information
          
    if !config.noweb
      if config.debugClient
        script(src="/javascript/libs/jquery-2.2.4.js")
        script(src="/javascript/libs/jquery.easydate-0.2.4.js")
        script(src="/javascript/libs/bootstrap.js")
        script(src="/shared/lodash.js")
        script(src="/javascript/libs/backbone.js")
        script(src="/javascript/libs/oauth.js")
        script(src="/javascript/libs/sha1.js")
        script(src="/javascript/libs/spin.js")
        script(src="/javascript/libs/jquery-spin.js")
        script(src="/javascript/libs/jquery.fineuploader.js")
        script(src="/javascript/libs/wysihtml5-0.3.0.js")
        script(src="/javascript/libs/bootstrap-wysihtml5.js")
        script(src="/javascript/libs/select2.js")
        script(src="/javascript/libs/bootstrap-lightbox.js")
        if config.sockjs
          script(src="/javascript/libs/sockjs.js")
      else
        if config.noCDN
          script(src="/javascript/libs/jquery-2.2.4.min.js")
          script(src="/javascript/libs/bootstrap.min.js")
          script(src="/shared/lodash-min.js")
          script(src="/javascript/libs/backbone-min.js")
          script(src="/javascript/libs/spin.min.js")
          script(src="/javascript/libs/jquery.fineuploader.min.js")
          script(src="/javascript/libs/wysihtml5-0.3.0.min.js")
          script(src="/javascript/libs/select2.min.js")
          if config.sockjs
            script(src="/javascript/libs/sockjs.min.js")
        else
          script(src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js", integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js", integrity="sha384-7sVK908dLMjOwvGD47EHg9cxk32sTpllx4Qqg0vzxEIlyBSsK9UauzrqZl8SPP0+", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js", integrity="sha384-FwbQ7A+X0UT99MG4WBjhZHvU0lvi67zmsIYxAREyhabGDXt1x0jDiwi3xubEYDYw", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js", integrity="sha384-NNt9ocJfZhIg2c5PbM5G2a3tTaeXhEfqCHWHNB7htzaWKn8MwFkzVyGdzLA8QMX7", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js", integrity="sha384-42TRsE23GzHQqobaGq/ztrEcPEKDkg6hIb2Q5aNK1TJH9kCBPgCxjcD+V8JHyp8T", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/file-uploader/3.1.1/jquery.fineuploader.min.js", integrity="sha384-4I5M7IeYacs/DxdNapH3ZJWHpGDurSEJauRkgBLTK6CsKl1vodNWjNeYWqScb6kv", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/wysihtml5/0.3.0/wysihtml5.min.js", integrity="sha384-PnQt2OMXYkEzb0JokcAmMcT5g2xbk1w3l8isPt7kTZ2OHnVnC2xcxy8iUsiIet/C", crossorigin="anonymous")
          script(src="//cdnjs.cloudflare.com/ajax/libs/select2/3.4.1/select2.min.js", integrity="sha384-Bjg2cC/PBtxwe9XCP8SmjTXhPAU/u3pPvfvdQUp9cmQLY8fV2i+RAB4grzjuXOqJ", crossorigin="anonymous")        if config.sockjs

          if config.sockjs
            script(src="//cdnjs.cloudflare.com/ajax/libs/sockjs-client/0.3.2/sockjs-min.js", integrity="sha384-TfTpmLAfOnzYnGyQoXfZGuCTAAZspKwo6IsvPh6oedkmD3TmDvDukGLT7pZiDwlB", crossorigin="anonymous")
        script(src="/javascript/libs/jquery.easydate-0.2.4.min.js")
        script(src="/javascript/libs/oauth.min.js")
        script(src="/javascript/libs/sha1.min.js")
        script(src="/javascript/libs/jquery-spin.js")
        script(src="/javascript/libs/bootstrap-wysihtml5.js")
        script(src="/javascript/libs/bootstrap-lightbox.min.js")
      script(src="/shared/jade-runtime.js")
      script(src="/javascript/pump.js")
      script(src="/javascript/pump/auth.js")
      script(src="/javascript/pump/model.js")
      script(src="/javascript/pump/router.js")
      script(src="/javascript/pump/socket.js")
      script(src="/javascript/pump/view.js")

      each script in config.scripts
        script(src=script)

      script.
        /* @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt Apache-2.0 */
        if (!Pump) {
            Pump = {};
        }
        if (!Pump.config) {
            Pump.config = {};
        }
        _.extend(Pump.config, {
            site: "!{config.site}",
            mainImage: "!{config.mainImage}",
            haveEmail: !{config.haveEmail || false},
            requireEmail: !{config.requireEmail || false},
            disableRegistration: !{config.disableRegistration || false},
            canUpload: !{config.canUpload || false},
            debugClient: !{config.debugClient || false},
            sockjs: !{config.sockjs || false},
            nicknameBlacklist: !{JSON.stringify(config.nicknameBlacklist)}
        });

        Pump.initialData = !{data ? JSON.stringify(defang(data)) : 'null'};

        Pump.principal = !{principal ? JSON.stringify(defang(principal)) : 'null'};

        Pump.principalUser = !{principalUser ? JSON.stringify(defang(principalUser)) : 'null'};

        /* @license-end */
